



test_words = { 'abandon' : [ "放弃" , 0 ] } # 0忘记 1模糊 2掌握


# 添加生词
def save_new_word( new_word , paraphrase ):
    global test_words
    test_words.update( { new_word : [ paraphrase , 0 ] } ) # 默认权值0 忘记

# 更新单词
def update_word( word , para , value):
    global test_words
    test_words.update( { word : [ para , value ]} )

# 执行函数
def run():
    print("[test] 回车默认为 s , 即 模糊")
    for key in test_words:
        print(key , " : " , test_words[key][0] , test_words[key][1] )
        command = input("[warning] a:掌握 s:模糊 d:啥玩意这是") # command用于分级 a s d 掌握，模糊，不懂
        # print( "[test] command：" +  command )
        if command == "":
            print("[test] PASS!")
            command = "s"
        if command == "a":
            update_word( key , test_words[key][0] , 2 ) # 掌握
        elif command == "s":
            update_word(key, test_words[key][0], 1)
        elif command == "d":
            update_word(key, test_words[key][0], 0)

# 主循环函数
def mainF():
    while 1:
        print("[prompt] 请输入命令...")
        command = input()
        if command == "":
            continue
        if command[0] == ":": # 判断是命令
            if command == ":exit":
                print("已退出")
                break
            elif command == ":save":
                print("[prompt] 请输入单词")
                newword = input() # 单词
                print("[prompt] 请输入释义")
                para = input() # 释义
                save_new_word(newword, para)
            elif command == ":help":
                print("帮助按键 -- :exit 退出")
            else :
                print("错误的命令")
        else: # 背单词开始
            print("[test] 开始背他妈的单词")
            run()

if __name__ == "__main__":
    mainF()